<?php
/*
 * 车型分级
 * @package    auto
 * @author     yunian
 * @copyright  Copyright (c) 2013 ixdcw team
 * @version    $Id: 1cf1026d9bba84840bf42a3c21a2b683fea03521 $
 */
defined('IN_IXDCW') or exit('Access Denied');
include tpl('header');
show_menu($menus);
?>
	<div class="tt">注意事项</div>
	<table cellpadding="2" cellspacing="1" class="tb">
		<tr>
			<td>&nbsp;&nbsp;&nbsp;1、如果进行了<span class="f_red">修改</span>或<span class="f_red">删除</span>分级操作，为了保证操作速度，系统不自动修复结构。请在<span class="f_red">管理完成</span>或<span class="f_red">操作失败</span>时，点更新缓存以修复分级结构至最新。</td>
		</tr>
		<tr>
			<td>&nbsp;&nbsp;&nbsp;2、删除分级不会删除分级下的文章或信息，请在删除分级之前手动批量删除。</td>
		</tr>
		<tr>
			<td>&nbsp;&nbsp;&nbsp;3、修改上级ID可以快速修改分级的上级分级，改变分级结构。</td>
		</tr>
	</table>
	<div class="tt"><?php if ( isset($parentid) && !empty($parentid) ) echo $RANK[$parentid]['name'];?>分级管理</div>
	<form method="post">
		<table cellpadding="2" cellspacing="1" class="tb">
			<tr>
				<th width="25"><input type="checkbox" onclick="checkall(this.form);"/></th>
				<th>排序</th>
				<th>ID</th>
				<th>上级ID</th>
				<th>分级名</th>
				<th>分级目录</th>
				<th>索引</th>
				<th colspan="2">信息数量</th>
				<th>子类</th>
				<th width="80">操作</th>
			</tr>
			<?php foreach ($XDRANK as $k => $v) { ?>
				<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
					<td><input type="checkbox" name="arids[]" value="<?php echo $v['arid'];?>"/></td>
					<td><input name="category[<?php echo $v['arid'];?>][listorder]" type="text" size="3" value="<?php echo $v['listorder'];?>"/></td>
					<td>&nbsp;<a href="<?php echo $MODULE[$moduleid]['linkurl'] . $v['linkurl'];?>" target="_blank"><?php echo $v['arid'];?></a>&nbsp;</td>
					<td><input name="category[<?php echo $v['arid'];?>][parentid]" type="text" size="5" value="<?php echo $v['parentid'];?>"/></td>
					<td>
						<input name="category[<?php echo $v['arid'];?>][name]" type="text" value="<?php echo $v['name'];?>" style="width:100px;color:<?php echo $v['style'];?>"/>
						<?php echo dstyle('category[' . $v['arid'] . '][style]', $v['style']);?>
					</td>
					<td><input name="category[<?php echo $v['arid'];?>][nickname]" type="text" value="<?php echo $v['nickname'];?>" size="10"/></td>
					<td>
						<input name="category[<?php echo $v['arid'];?>][letter]" type="text" value="<?php echo $v['letter'];?>" size="1"/>
					</td>
					<td>
						<script type="text/javascript">perc(<?php echo $v['item'];?>,<?php echo $total;?>, '80px');</script>
					</td>
					<td><?php echo $v['item'];?></td>
					<td title="管理子分级"><a href="?file=<?php echo $file;?>&typename=<?php echo $typename?>&moduleid=<?php echo $moduleid;?>&parentid=<?php echo $v['arid'];?>"><?php echo $v['childs'];?></a></td>
					<td>
						<a href="?file=<?php echo $file;?>&typename=<?php echo $typename?>&action=add&moduleid=<?php echo $moduleid;?>&parentid=<?php echo $v['arid'];?>"><img src="admin/image/add.png" width="16" height="16" title="添加子分级" alt=""/></a>&nbsp;
						<a href="?file=<?php echo $file;?>&typename=<?php echo $typename?>&action=edit&moduleid=<?php echo $moduleid;?>&arid=<?php echo $v['arid'];?>"><img src="admin/image/edit.png" width="16" height="16" title="修改" alt=""/></a>&nbsp;
						<a href="?file=<?php echo $file;?>&typename=<?php echo $typename?>&action=delete&moduleid=<?php echo $moduleid;?>&arid=<?php echo $v['arid'];?>&parentid=<?php echo $parentid;?>" onclick="return _delete();"><img src="admin/image/delete.png" width="16" height="16" title="删除" alt=""/></a></td>
				</tr>
			<?php }?>
		</table>
		<div class="btns">
			<span class="f_r">
			分级总数:<strong class="f_red"><?php echo count($RANK);?></strong>&nbsp;&nbsp;
			当前目录:<strong class="f_blue"><?php echo count($XDRANK);?></strong>&nbsp;&nbsp;
			</span>
			<input type="submit" name="submit" value="更新分级" class="btn" onclick="this.form.action='?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&parentid=<?php echo $parentid;?>&action=update&typename=<?php echo $typename?>'"/>&nbsp;
			<input type="submit" value="删除选中" class="btn" onclick="if(confirm('确定要删除选中分级吗？此操作将不可撤销')){this.form.action='?moduleid=<?php echo $moduleid;?>&file=<?php echo $file;?>&parentid=<?php echo $parentid;?>&action=delete&typename=<?php echo $typename?>'}else{return false;}"/>
			<?php if ($parentid) { ?>&nbsp;
				<input type="button" value="上级分级" class="btn" onclick="window.location='?file=<?php echo $file;?>&moduleid=<?php echo $moduleid;?>&parentid=<?php echo $RANK[$parentid]['parentid'];?>&typename=<?php echo $typename?>';"/>
			<?php }?>
		</div>
	</form>
	<script type="text/javascript">
		Menuon(1);
	</script>
<?php include tpl('footer'); ?>